# Copyright 2022 99Cloud, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# flake8: noqa
# fmt: off

"""cgw

Revision ID: f21ae76770ce
Revises: b8dbd693ca39
Create Date: 2023-02-16 11:49:04.686039

"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'f21ae76770ce'
down_revision = 'b8dbd693ca39'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('cgw',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('create_time', sa.DateTime(), nullable=False),
    sa.Column('update_time', sa.DateTime(), nullable=False),
    sa.Column('cgw_level', sa.Integer(), nullable=False),
    sa.Column('lane_id', sa.Integer(), nullable=False),
    sa.Column('average_speed', sa.Integer(), nullable=False),
    sa.Column('sensor_pos', sa.JSON(), nullable=False),
    sa.Column('start_point', sa.JSON(), nullable=False),
    sa.Column('end_point', sa.JSON(), nullable=False),
    sa.Column('sec_mark', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_cgw_cgw_level'), 'cgw', ['cgw_level'], unique=False)
    op.create_index(op.f('ix_cgw_id'), 'cgw', ['id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_cgw_id'), table_name='cgw')
    op.drop_index(op.f('ix_cgw_cgw_level'), table_name='cgw')
    op.drop_table('cgw')
    # ### end Alembic commands ###
